package cn.threewaters.qtyy.dit.one.entity;

import java.util.List;

import com.baomidou.mybatisplus.annotations.TableField;

import cn.threewaters.qtyy.dit.one.entity.base.OneBaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@EqualsAndHashCode(callSuper = false)
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "用户对象")
public class SysUser extends OneBaseModel<SysUser> {

	private static final long serialVersionUID = -1359868291344976623L;

	@ApiModelProperty(value = "登录账号", example = "testuser")
	private String username;

	@ApiModelProperty(value = "登录密码", example = "testuser")
	private String password;

	@ApiModelProperty(value = "用户编码", example = "10001")
	private String usercode;

	@ApiModelProperty(value = "真实姓名", example = "testuser")
	private String realname;

	@ApiModelProperty(value = "用户性别", example = "1")
	private Integer sex;

	@ApiModelProperty(value = "邮箱", example = "test@threewaters.cn")
	private String email;

	@ApiModelProperty(value = "用户电话", example = "3333333")
	private String phone;

	@ApiModelProperty(value = "用户头像路径", example = "/1.jpg")
	private String photo;

	@ApiModelProperty(value = "密码加密盐值", hidden = true)
	private String salt;

	@TableField(exist = false)
	private List<String> roles;

	/**
	 * 密码盐.
	 * 
	 * @return
	 */
	public String getCredentialsSalt() {
		return this.username + this.salt;
	}

}
